﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Interop.Excel;
using ExcellData;
using System.Reflection;

namespace ExcelUtilities12
{
	public class Range12 : IExcelRange
	{
		private Range _Range;

		public Range12(Range range)
		{
			_Range = range;
		}

		#region Methods
		public IExcelRange get_Resize(object RowSize, object ColumnSize)
		{
			return new Range12(_Range.get_Resize(RowSize, ColumnSize));
		}
		public void set_Value(object value)
		{
			_Range.set_Value(Missing.Value, value);
		}
		public void AutoFit()
		{
			_Range.EntireColumn.AutoFit();
		}
		public void Merge()
		{
			_Range.Merge(Missing.Value);
		}
		public void FillBorders(EExcelLineStyle lineStyle, EExcelBorderWeight weight)
		{
			_Range.Borders.Weight = weight;
			_Range.Borders[XlBordersIndex.xlEdgeBottom].LineStyle = lineStyle;
			_Range.Borders[XlBordersIndex.xlEdgeLeft].LineStyle = lineStyle;
			_Range.Borders[XlBordersIndex.xlEdgeRight].LineStyle = lineStyle;
			_Range.Borders[XlBordersIndex.xlEdgeTop].LineStyle = lineStyle;
			_Range.Borders[XlBordersIndex.xlInsideHorizontal].LineStyle = lineStyle;
			_Range.Borders[XlBordersIndex.xlInsideVertical].LineStyle = lineStyle;
		}
		public void BorderAround(EExcelLineStyle lineStyle, EExcelBorderWeight weight)
		{
			_Range.BorderAround(lineStyle, (XlBorderWeight)(weight), XlColorIndex.xlColorIndexAutomatic, Missing.Value);
		}
		#endregion

		#region Properties
		public EExcelHorizontalAlign HorizontalAlignment
		{
			get { return (EExcelHorizontalAlign)_Range.HorizontalAlignment; }
			set { _Range.HorizontalAlignment = value; }
		}
		public IExcelRange EntireColumn { get { return new Range12(_Range.EntireColumn); } }
		public IExcelRange EntireRow { get { return new Range12(_Range.EntireRow); } } 
		#endregion
	}
}
